package com.yunnuo.system.role.service.impl;

import com.yunnuo.system.comm.util.Empty;
import com.yunnuo.system.comm.util.Page;
import com.yunnuo.system.comm.util.Where;
import com.yunnuo.system.role.dao.IRoleMenuDao;
import com.yunnuo.system.role.entity.RoleMenu;
import com.yunnuo.system.role.service.IRoleMenuService;
import org.hibernate.service.spi.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by w_weihf on 2018/8/3.
 */
@Service
public class RoleMenuServiceImpl  implements IRoleMenuService {

    @Autowired
    private IRoleMenuDao roleMenuDao;
    @Override
    public void addVO(RoleMenu vo) throws ServiceException {

    }

    @Override
    public void updateVO(RoleMenu vo) throws ServiceException {

    }

    @Override
    public void delList(String[] ids) throws ServiceException {
    }

    @Override
    public void deleteVo(String id) throws ServiceException {

    }

    @Override
    public List<RoleMenu> findList() throws ServiceException {
        return null;
    }

    @Override
    public List<?> findList(RoleMenu vo, String other) throws ServiceException {
        return null;
    }

    @Override
    public RoleMenu findVO(String id) throws ServiceException {
        return null;
    }

    @Override
    public int selectCountUserRoleByRoleId(String roleId) {
         List  list = this.roleMenuDao.findAllByRoleId(roleId);
        if(Empty.isNotEmpty(list)){
            return list.size();
        }else{
            return 0;
        }

    }

    @Override
    public int selectCountRoleMenuByMenuId(String menuId) {
        List  list = this.roleMenuDao.findAllByMenuId(menuId);
        if(Empty.isNotEmpty(list)){
            return list.size();
        }else{
            return 0;
        }
    }
}
